package lesson17Inheritance.car;

public class Car {
	protected String model;
	private double maxSpeed=330;
	protected double currentSpeed;
	protected int currentGear;
	protected int numberOfDoors;
	private int idNumber;
	protected boolean isSportCar;
	protected Person owner;
	protected String type = "just a car";
	
	Car(double maxSpeed){
		if(maxSpeed> 0 && maxSpeed< 450){
			this.maxSpeed = maxSpeed;
		}
	}
	void changeOwner(Person newOwner){                                                      
		owner = newOwner;
	}
	
	void startEngine(){
		System.out.println("Engine is started!Brum !");
		currentGear=1;
		currentSpeed = 0;
	}
	
	void changeGear(int gear){
		if(gear>=0 && gear <7){
			currentGear = gear;
		}
	}
	void accelerate(double speed){
		
		if(currentSpeed + speed <= maxSpeed){
			currentSpeed+=speed;
		}else
			currentSpeed = maxSpeed;
		System.out.println("now driving with " + currentSpeed +" km/h");

	}
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return "max Speed: " + this.maxSpeed;
	}
	
}
 